package aufgabe3_chat.chatGui;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;

import aufgabe3_chat.Chat_User_Administration;

public class Userliste extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JTextArea textArea;

	/**
	 * Create the frame.
	 */
	public Userliste() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		setTitle("Aktuelle Nutzer");
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		textArea = new JTextArea();
		textArea.setEditable(false);
		textArea.setBounds(10, 10, 414, 240);
		
		JScrollPane scrollPane = new JScrollPane(textArea);
		scrollPane.setBounds(10, 10, 414, 241);
		contentPane.add(scrollPane);
		
		
	}
	
	public void makeListe(Chat_User_Administration userliste){
		textArea.setText("");
		for(String adresse : userliste.get_user_list().keySet()){
			textArea.append(userliste.get_val(adresse)+" : " + adresse + "\n");
		}
	}
}
